package com.hertz.iris.ui;

import javax.inject.Inject;

import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import butterknife.ButterKnife;

import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.Menu;
import com.hertz.iris.Injector;
import com.hertz.iris.IrisServiceProvider;
import com.hertz.iris.R;
import com.hertz.iris.util.Constants;
import com.hertz.iris.util.Ln;


/**
 * Base class for all Bootstrap Activities that need fragments.
 */
public class IrisFragmentActivity extends SherlockFragmentActivity {
	
	@Inject IrisServiceProvider irisServiceProvider;
	
	
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Injector.inject(this);
    }

    @Override
    public void setContentView(int layoutResId) {
        super.setContentView(layoutResId);
        ButterKnife.inject(this);
        
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getSupportMenuInflater().inflate(R.menu.action_buttons, menu);
        return true;
    }
    
    public String getOpenIdToken(){
    	SharedPreferences sharedPreferences = getSharedPreferences(Constants.MyPreference.PREFERENCE_NAME, Context.MODE_PRIVATE);
    	String openIdToken = sharedPreferences.getString(Constants.MyPreference.OPEN_ID_TOKEN, "");
    	Ln.d("openIdToken = %s", openIdToken);
    	return openIdToken;
    }
    
}
